//
//  NEUser.m
//  NLiteAVDemo
//
//  Created by I am Groot on 2020/8/20.
// Copyright (c) 2021 NetEase, Inc.  All rights reserved.
// Use of this source code is governed by a MIT license that can be found in the LICENSE file.

#import "NEUser.h"
#import "NSDictionary+NTESJson.h"

@implementation NEUser

- (instancetype)initWithDictionary:(NSDictionary *)dic
{
    if (!dic) { return nil; }
    if (self = [super init]) {
        _mobile = [dic jsonString:@"mobile"];
        _imAccid = [dic jsonString:@"imAccid"];
        _imToken = [dic jsonString:@"imToken"];
        _avRoomUid = [dic jsonString:@"avRoomUid"];
        _avatar = [dic jsonString:@"avatar"];
        _accountId = [dic jsonString:@"accountId"];
        _nickname = [dic jsonString:@"nickname"];

    }
    return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:self.mobile forKey:@"mobile"];
    [coder encodeObject:self.imAccid forKey:@"imAccid"];
    [coder encodeObject:self.imToken forKey:@"imToken"];
    [coder encodeObject:self.avRoomUid forKey:@"avRoomUid"];
    [coder encodeObject:self.avatar forKey:@"avatar"];
    [coder encodeObject:self.accountId forKey:@"accountId"];
    [coder encodeObject:self.nickname forKey:@"nickname"];

}
- (nullable instancetype)initWithCoder:(NSCoder *)coder {
    if (self = [super init]) {
        self.mobile = [coder decodeObjectForKey:@"mobile"];
        self.imAccid = [coder decodeObjectForKey:@"imAccid"];
        self.imToken = [coder decodeObjectForKey:@"imToken"];
        self.avRoomUid = [coder decodeObjectForKey:@"avRoomUid"];
        self.avatar = [coder decodeObjectForKey:@"avatar"];
        self.accountId = [coder decodeObjectForKey:@"accountId"];
        self.nickname = [coder decodeObjectForKey:@"nickname"];
    }
    return self;
}

@end
